package kotan.view;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import kotan.view.table.EntityTableView;

public class AppPanel extends JPanel {
    
    private static final long serialVersionUID = 1L;
    private final Map<String, EntityTableView> views = new HashMap<String, EntityTableView>();
    private JTabbedPane tabbedPane;

    public AppPanel() {
        initComponents();
    }

    private void initComponents() {
        tabbedPane = new JTabbedPane();
        this.setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        this.add(tabbedPane, gbc);
    }

    public void addTab(String kind, EntityTableView entityTableView) {
        views.put(kind, entityTableView);
        tabbedPane.addTab(kind, entityTableView);
    }
    
    public EntityTableView getEntityViewerPanel(String kind) {
        return views.get(kind);
    }


}
